package br.uff.busuffweb.model;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author jthiago
 */
@NamedQueries({
    @NamedQuery(name = "ParadaCircuito.getTodos",
    query = "select pc from ParadaCircuito pc order by pc.id"),
    
    @NamedQuery(name = "ParadaCircuito.getPorCircuito",
    query = "select pc from ParadaCircuito pc " +
            " where pc.circuito = ?"),
    
    @NamedQuery(name = "ParadaCircuito.getPorParada",
    query = "select pc from ParadaCircuito pc " +
            " where pc.parada = ?"),
    
    @NamedQuery(name = "ParadaCircuito.getPorParadaECircuito",
    query = "select pc from ParadaCircuito pc " +
            " where pc.parada = ? and pc.circuito = ?"),
    
    @NamedQuery(name = "ParadaCircuito.getPorParadaECircuitoENumero",
    query = "select pc from ParadaCircuito pc " +
            " where pc.parada = ? and pc.circuito = ? and pc.numero = ?"),
    
    @NamedQuery(name = "ParadaCircuito.getPorCircuitoENumero",
    query = "select pc from ParadaCircuito pc " +
            " where pc.circuito = ? and pc.numero = ?"),
    
    @NamedQuery(name = "ParadaCircuito.getPorParadaENumero",
    query = "select pc from ParadaCircuito pc " +
            " where pc.parada = ? and pc.numero = ?")
})
@Entity
@SequenceGenerator(sequenceName = "seq_paradaCircuito", name = "Sequencia")
@Table(name = "paradaCircuito")
public class ParadaCircuito implements Serializable {
    
    @Id
    @GeneratedValue(generator = "Sequencia", strategy = GenerationType.AUTO)
    private Long id;
    
    @ManyToOne
    @JoinColumn(name="idCircuito")
    private Circuito circuito;
    
    @ManyToOne
    @JoinColumn(name="idParada")
    private Parada parada;    
    
    private Integer numero;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Circuito getCircuito() {
        return circuito;
    }

    public void setCircuito(Circuito circuito) {
        this.circuito = circuito;
    }

    public Parada getParada() {
        return parada;
    }

    public void setParada(Parada parada) {
        this.parada = parada;
    }

    public Integer getNumero() {
        return numero;
    }

    public void setNumero(Integer numero) {
        this.numero = numero;
    }
}
